# CoinGecko

## Hooks

### useCoingeckoPrice

Given base token name and the supported currencies to get token price from CoinGecko.

**Parameters**

- ``base: string`` - the token name that you can get at URL while search in CoinGecko. Or find the token from https://api.coingecko.com/api/v3/coins/list
- ``quote: string`` - (optional) the supported currencies in CoinGecko. Default quote is `usd`. See https://api.coingecko.com/api/v3/simple/supported_vs_currencies

**Returns**

- ``string | undefined`` - token price

**Example**

import { ExampleContainer } from '/src/examples/ExampleContainer';
import EthPrice from '../../example-loader.js!/src/examples/EthPrice.tsx'

<ExampleContainer example={EthPrice}/>

### useCoingeckoTokenPrice

Given token contract and the supported currencies to get token price from CoinGecko.

**Parameters**

- ``contract: string`` - the token contract
- ``quote: string`` - (optional) the supported currencies in CoinGecko. Default quote is `usd`. See https://api.coingecko.com/api/v3/simple/supported_vs_currencies
- ``platform: string`` - (optional) the platform issuing tokens. Default platform id is `ethereum`. See https://api.coingecko.com/api/v3/asset_platforms

**Returns**

- ``string | undefined`` - token price

**Example**

import WethPrice from '../../example-loader.js!/src/examples/WethPrice.tsx'

<ExampleContainer example={WethPrice}/>
